<template>
  <div class="product-info-container">
    <!-- 顶部产品概览 -->
    <el-card class="product-overview" shadow="never">
      <div class="overview-content">
        <div class="product-left">
          <div class="product-image">
            <img :src="pinia.trace.CoverImage" alt="产品图片" />
            
          </div>
          <div class="product-details">
            <h2 class="product-title">{{ pinia.trace.CommodityName }}</h2>
            <div class="product-meta">
              <div class="meta-item">生产批次: {{ pinia.trace.ProductionBatch }}</div>
              <div class="meta-item">保质期: {{pinia.trace.ShelfLife}}天</div>
              <div class="meta-item">生产许可证号: {{ pinia.trace.LicenseNumber }}</div>
              <div class="meta-item">生产企业: {{ pinia.trace.ProductionEnterprises }}</div>
            </div>
            <div class="inspection-report">
              <label>产品检验报告
                <span style="color: red;">(上限9张)</span>
              </label>
              <div class="upload-area">
                <el-upload
            
    :file-list="fileList"
    v-model="fileList"
    action="http://localhost:5073/api/Img/Images"
    list-type="picture-card"
    :limit="9"
    
     :on-success="handleSuccess"
    :on-preview="handlePictureCardPreview"
    :on-remove="handleRemove"
   
  >
    <el-icon><Plus /></el-icon>
  </el-upload>

 
  
  <el-dialog v-model="dialogVisible">
    <img   w-full   :src="dialogImageUrl" alt=""/> 
  </el-dialog>
              </div>
            </div>
          </div>
        </div>
        <div class="product-actions">
          <el-button type="primary">修改基本信息</el-button>
          <el-button>导出溯源码</el-button>
        </div>
      </div>
    </el-card>

    <!-- 主要信息标签页 -->
    <el-card class="main-content" shadow="never">
      <el-tabs v-model="activeTab" class="info-tabs">
        <el-tab-pane label="养殖信息" name="cultivation">
          <div class="tab-content">
            <!-- 养殖信息卡片 -->
            <el-card class="info-card" shadow="never">
              <template #header>
                <div class="card-header">
                  <span>养殖信息</span>
                  <div class="header-actions">
                     <el-button size="small" type="primary"   @click="disegient= true"  :disabled="status==true">添加</el-button> 
                    <el-button size="small" type="primary"   @click="updDisegient= true" :disabled="status!=true" >修改</el-button>
                    
                    <el-dialog
    v-model="disegient"
    title="养殖信息添加"
    width="500"
   
  >
  <el-form
    ref="ruleFormRef"
    style="max-width: 600px"
    :model="ruleForm"
    :rules="rules"
    label-width="auto"
  >
    <el-form-item label="品种" prop="variety">
      <el-input v-model="ruleForm.variety" />
    </el-form-item>
    
    <el-form-item label="来源" prop="source">
      <el-input v-model="ruleForm.source" />
    </el-form-item>
    
    <el-form-item label="饲养天数" prop="numberDays">
      <el-input v-model="ruleForm.numberDays"  />
    </el-form-item>

    <el-form-item label="饲料品牌" prop="feedBrand">
      <el-input v-model="ruleForm.feedBrand" />
    </el-form-item>

    <el-form-item label="饲养负责人" prop="breedingManager">
      <el-input v-model="ruleForm.breedingManager" />
    </el-form-item>

    <el-form-item label="出栏日期" prop="dateOfSlaughter">
      <el-date-picker
        v-model="ruleForm.dateOfSlaughter"
        type="date"
        placeholder="请选择"
        value-format="YYYY-MM-DDTHH:mm:ss"
      />
    </el-form-item>
    <el-form-item>
      <el-button type="primary" @click="createCultivationsubmitForm(ruleFormRef)">
        保存
      </el-button>
      <el-button @click="resetForm(ruleFormRef)">取消</el-button>
    </el-form-item>
  </el-form>
  
  </el-dialog>


  <el-dialog
    v-model="updDisegient"
    title="养殖信息修改"
    width="500"
   
  >
  <el-form
    ref="ruleFormRef"
    style="max-width: 600px"
    :model="ruleForm"
    :rules="rules"
    label-width="auto"
  >
    <el-form-item label="品种" prop="variety">
      <el-input v-model="ruleForm.variety" />
    </el-form-item>
    
    <el-form-item label="来源" prop="source">
      <el-input v-model="ruleForm.source" />
    </el-form-item>
    
    <el-form-item label="饲养天数" prop="numberDays">
      <el-input v-model="ruleForm.numberDays" type="number" />
    </el-form-item>

    <el-form-item label="饲料品牌" prop="feedBrand">
      <el-input v-model="ruleForm.feedBrand" />
    </el-form-item>

    <el-form-item label="饲养负责人" prop="breedingManager">
      <el-input v-model="ruleForm.breedingManager" />
    </el-form-item>

    <el-form-item label="出栏日期" prop="dateOfSlaughter">
      <el-date-picker
        v-model="ruleForm.dateOfSlaughter"
        type="date"
        placeholder="请选择"
        value-format="YYYY-MM-DDTHH:mm:ss"
      />
    </el-form-item>
    <el-form-item>
      <el-button type="primary" @click="UpdateCultivationsubmitForm(ruleFormRef)">
        保存
      </el-button>
      <el-button @click="resetForm(ruleFormRef)">取消</el-button>
    </el-form-item>
  </el-form>
  
  </el-dialog>


                  </div>
                </div>
              </template>
              <div class="info-content">
                <div class="info-row">
                  <span class="label">品种:</span>
                  <span class="value">{{ ruleForm.variety }}</span>
                </div>
                <div class="info-row">
                  <span class="label">来源:</span>
                  <span class="value">{{ ruleForm.source }}</span>
                </div>
                <div class="info-row">
                  <span class="label">饲养天数:</span>
                  <span class="value">{{ruleForm.numberDays}}天</span>
                </div>
                <div class="info-row">
                  <span class="label">饲料品牌:</span>
                  <span class="value">{{ ruleForm.feedBrand }}</span>
                </div>
                <div class="info-row">
                  <span class="label">饲养负责人:</span>
                  <span class="value">{{ ruleForm.breedingManager }}</span>
                </div>
                <div class="info-row">
                  <span class="label">出栏日期:</span>
                  <span class="value">{{ moment(ruleForm.dateOfSlaughter).format("YYYY-MM-DD")  }}</span>
                </div>
              </div>
             
            </el-card>

            


            <!-- 保健信息卡片 -->
            <el-card class="info-card" shadow="never">
              <template #header>
                <div class="card-header">
                  <span>保健信息</span>
                  <div class="header-actions">
                    
                    
                    <el-button size="small" type="primary" @click="addDomain">新增行</el-button>
                   
              
                  </div>
                </div>
              </template>
              <el-table :data="healthData" border  style="width: 100%">

                <el-table-column 
        prop="days" 
        label="饲养天数" 
        align="left"
        width="200"
      > 
        <template #default="scope">
          <template v-if="scope.row.isEditing">
            <el-input 
              v-model="scope.row.days" 
              size="small"
              placeholder="请输入饲养天数"
              type="number"
            ></el-input>
          </template>
          <template v-else>
            {{ scope.row.days }}
          </template>
        </template>
      </el-table-column>

      <el-table-column 
        prop="method" 
        label="保健方式" 
        align="left"
        width="250"
      >
        <template #default="scope">
          <template v-if="scope.row.isEditing">
            <el-input 
              v-model="scope.row.method" 
              size="small"
              placeholder="请输入保健方式"
            ></el-input>
          </template>
          <template v-else>
            {{ scope.row.method }}
          </template>
        </template>
      </el-table-column>

      <el-table-column 
        prop="details" 
        label="保健方法" 
        align="left"
        width="250"
      >
        <template #default="scope">
          <template v-if="scope.row.isEditing">
            <el-input 
              v-model="scope.row.details" 
              size="small"
              placeholder="请输入保健方法"
            ></el-input>
          </template>
          <template v-else>
            {{ scope.row.details }}
          </template>
        </template>
      </el-table-column>

      <el-table-column 
        label="操作" 
        align="left"
        width="180"
      >
        <template #default="scope">
          <template v-if="scope.row.isEditing">
            <el-button 
              
              size="mini" 
              @click="handleSave(scope.$index)"
              class="mr-1"
            >
              保存
            </el-button>
            <el-button 
            
              size="mini" 
              @click="handleCancel(scope.$index)"
            >
              取消
            </el-button>
          </template>
          <template v-else>
            <el-button 
             
              size="mini" 
              @click="handleEdit(scope.$index)"
              class="mr-1 text-blue-600"
            >
              修改
            </el-button>
            <el-button 
             
              size="mini" 
              @click="handleDelete(scope.$index)"
              class="text-red-600"
            >
              删除
            </el-button>
          </template>
        </template>
      </el-table-column>
</el-table>

    
 
              
            </el-card>

            <!-- 动检证卡片 -->
            <el-card class="info-card" shadow="never">
              <template #header>
                <div class="card-header">
                  <span>动检证</span>
                  <span style="color: red;">(上限9张)</span>
                </div>
              </template>
              <div class="upload-area">
                <el-upload
            
            :file-list="fileListmotion"
            v-model="fileListmotion"
            action="http://localhost:5073/api/Img/Images"
            list-type="picture-card"
            :limit="9"
            
             :on-success="handleSuccessMotionInspection"
            :on-preview="handlePictureCardPreviewMotionInspection"
            :on-remove="handleRemoveMotionInspection"
           
          >
            <el-icon><Plus /></el-icon>
          </el-upload>
        
          
          
          <el-dialog v-model="dialogVisiblemotion">
            <img   w-full   :src="dialogImageUrlmotion" alt=""/> 
          </el-dialog>

              </div>
            </el-card>

            <!-- 企业信息卡片 -->
            <el-card class="info-card" shadow="never">
              <template #header>
                <div class="card-header">
                  <span>企业信息</span>
                  <div class="header-actions">
                    <el-button size="small" type="primary" @click="dialogVisibleQiye=true">设置</el-button>
                    
                  </div>
                </div>
              </template>
              <div class="info-content">
                <div class="info-row">
                  <span class="label">养殖场:</span>
                  <span class="value">{{ ruleForm.farms }}</span>
                </div>
                <div class="info-row">
                  <span class="label">存栏数量:</span>
                  <span class="value">{{ruleForm.number}}只</span>
                </div>
                <div class="info-row">
                  <span class="label">负责人:</span>
                  <span class="value">{{ruleForm.head}}总</span>
                </div>
              </div>
            </el-card>

          
              <el-dialog
    v-model="dialogVisibleQiye"
    title="企业信息"
    width="500"
   
  >
   
  <el-form
    ref="ruleFormRef"
    style="max-width: 600px"
    :model="ruleForm"
    :rules="rulesqiye"
    label-width="auto"
  >
    <el-form-item label="养殖场" prop="farms">
      <el-input v-model="ruleForm.farms" />
    </el-form-item>

     <el-form-item label="存栏数量" prop="number">
      <el-input v-model="ruleForm.number" />
    </el-form-item>

     <el-form-item label="负责人" prop="head">
      <el-input v-model="ruleForm.head" />
    </el-form-item>
  
    <el-form-item>
      <el-button type="primary" @click="submitFormQiye(ruleFormRef)">
       确认
      </el-button>
    </el-form-item>
  </el-form>


  </el-dialog>




            <!-- 企业照片卡片 -->
            <el-card class="info-card" shadow="never">
              <template #header>
                <div class="card-header">
                  <span>企业照片</span>
                </div>
              </template>
              <div class="upload-area">
                <el-upload
            
            :file-list="fileListEnterprise"
            v-model="fileListEnterprise"
            action="http://localhost:5073/api/Img/Images"
            list-type="picture-card"
            :limit="9"
            
             :on-success="handleSuccessEnterprise"
            :on-preview="handlePictureCardPreviewEnterprise"
            :on-remove="handleRemoveEnterprise"
           
          >
            <el-icon><Plus /></el-icon>
          </el-upload>
        
          
          
          <el-dialog v-model="dialogVisibleEnterprise">
            <img   w-full   :src="dialogImageUrlEnterprise" alt=""/> 
          </el-dialog>
              </div>
            </el-card>
          </div>
        </el-tab-pane>

        <el-tab-pane label="屠宰信息" name="slaughter">
          <div class="tab-content">
            <!-- 屠宰信息卡片 -->
            <el-card class="info-card" shadow="never">
              <template #header>
                <div class="card-header">
                  <span>屠宰信息</span>
                  <div class="header-actions">
                       <el-button size="small" type="primary"   @click="disegientSlaughter= true"  :disabled="statusSlaughter==true">添加</el-button> 
                    <el-button size="small" type="primary"   @click="updDisegientSlaughter= true" :disabled="statusSlaughter!=true" >修改</el-button>
                    
                    <el-dialog
    v-model="disegientSlaughter"
    title="屠宰信息添加"
    width="500"
   
  >
  <el-form
    ref="ruleFormRefSlaughter"
    style="max-width: 600px"
    :model="ruleFormSlaughter"
    :rules="rulesSlaughter"
    label-width="auto"
  >
    <el-form-item label="批次" prop="batch">
      <el-input v-model="ruleFormSlaughter.batch" />
    </el-form-item>
    
    <el-form-item label="到厂均重" prop="averageWeight">
      <el-input v-model="ruleFormSlaughter.averageWeight" />
    </el-form-item>
    
    <el-form-item label="到厂时间" prop="arrivalTime">
       <el-date-picker
        v-model="ruleFormSlaughter.arrivalTime"
        type="date"
        placeholder="请选择"
        value-format="YYYY-MM-DDTHH:mm:ss"
      />
    </el-form-item>

    <el-form-item label="屠宰时间" prop="slaughterTime">
       <el-date-picker
        v-model="ruleFormSlaughter.slaughterTime"
        type="date"
        placeholder="请选择"
        value-format="YYYY-MM-DDTHH:mm:ss"
      />
    </el-form-item>

  
  
    <el-form-item>
      <el-button type="primary" @click="createCultivationsubmitFormSlaughter(ruleFormRefSlaughter)">
        保存
      </el-button>
      <el-button @click="resetFormSlaughter(ruleFormRefSlaughter)">取消</el-button>
    </el-form-item>
  </el-form>
  
  </el-dialog>


  <el-dialog
    v-model="updDisegientSlaughter"
    title="屠宰信息修改"
    width="500"
   
  >
  <el-form
    ref="ruleFormRefSlaughter"
    style="max-width: 600px"
    :model="ruleFormSlaughter"
    :rules="rulesSlaughter"
    label-width="auto"
  >
   <el-form-item label="批次" prop="batch">
      <el-input v-model="ruleFormSlaughter.batch" />
    </el-form-item>
    
    <el-form-item label="到厂均重" prop="averageWeight">
      <el-input v-model="ruleFormSlaughter.averageWeight" />
    </el-form-item>
    
    <el-form-item label="到厂时间" prop="arrivalTime">
       <el-date-picker
        v-model="ruleFormSlaughter.arrivalTime"
        type="date"
        placeholder="请选择"
        value-format="YYYY-MM-DDTHH:mm:ss"
      />
    </el-form-item>

    <el-form-item label="屠宰时间" prop="slaughterTime">
       <el-date-picker
        v-model="ruleFormSlaughter.slaughterTime"
        type="date"
        placeholder="请选择"
        value-format="YYYY-MM-DDTHH:mm:ss"
      />
    </el-form-item>

    <el-form-item>
      <el-button type="primary" @click="UpdateCultivationsubmitFormSlaughter(ruleFormRefSlaughter)">
        保存
      </el-button>
      <el-button @click="resetFormSlaughter(ruleFormRefSlaughter)">取消</el-button>
    </el-form-item>
  </el-form>
  
  </el-dialog>
                    
                  </div>
                </div>
              </template>
              <div class="info-content">
                <div class="info-row">
                  <span class="label">批次:</span>
                  <span class="value">{{ ruleFormSlaughter.batch }}</span>
                </div>
                <div class="info-row">
                  <span class="label">到厂时间:</span>
                  <span class="value">{{moment(ruleFormSlaughter.arrivalTime).format("YYYY年MM月DD日 HH:mm:ss") }}</span>
                </div>
                <div class="info-row">
                  <span class="label">到厂均重:</span>
                  <span class="value">{{ruleFormSlaughter.averageWeight}}公斤</span>
                </div>
                <div class="info-row">
                  <span class="label">屠宰时间:</span>
                  <span class="value">{{ moment(ruleFormSlaughter.slaughterTime).format("YYYY年MM月DD日 HH:mm:ss") }}</span>
                </div>
              </div>
            </el-card>

            <!-- 相关资质卡片 -->
            <el-card class="info-card" shadow="never">
              <template #header>
                <div class="card-header">
                  <span>相关资质</span>
                </div>
              </template>
              <div class="upload-area">

                <el-upload
            
            :file-list="fileListSlaughter"
            v-model="fileListSlaughter"
            action="http://localhost:5073/api/Img/Images"
            list-type="picture-card"
            :limit="9"
            
             :on-success="handleSuccessSlaughter"
            :on-preview="handlePictureCardPreviewSlaughter"
            :on-remove="handleRemoveSlaughter"
           
          >
            <el-icon><Plus /></el-icon>
          </el-upload>
        
          
          
          <el-dialog v-model="dialogVisibleSlaughter">
            <img   w-full   :src="dialogImageUrlSlaughter" alt=""/> 
          </el-dialog>

              </div>
            </el-card>

            <!-- 企业信息卡片 -->
            <el-card class="info-card" shadow="never">
              <template #header>
                <div class="card-header">
                  <span>企业信息</span>
                  <div class="header-actions">
                    <el-button size="small" type="primary" @click="dialogVisiblegongsi=true">设置</el-button>
                    
                  </div>
                </div>
              </template>
              <div class="info-content">
                <div class="info-row">
                  <span class="label">公司名称:</span>
                  <span class="value">{{ ruleFormSlaughter.companyName }}</span>
                </div>
                <div class="info-row">
                  <span class="label">成立时间:</span>
                  <span class="value" v-if="ruleFormSlaughter.founded=='1000-01-01T00:00:00.000Z'">{{ moment(founded).format("YYYY年MM月DD日") }}</span>
                  <span class="value" v-if="ruleFormSlaughter.founded!='1000-01-01T00:00:00.000Z'">{{ moment(ruleFormSlaughter.founded).format("YYYY年MM月DD日") }}</span>
                </div>
                <div class="info-row">
                  <span class="label">公司地址:</span>
                  <span class="value">
                   {{ ruleFormSlaughter.provinceName }}{{ ruleFormSlaughter.urbanName }}{{ ruleFormSlaughter.companyAddress }}
                  </span>
                </div>
                <div class="info-row">
                  <span class="label">公司简介:</span>
                  <span class="value">{{ ruleFormSlaughter.companyProfile }}</span>
                </div>
              </div>


                <el-dialog
    v-model="dialogVisiblegongsi"
    title="企业信息设置"
    width="900"
   
  >

    <el-form
    ref="ruleFormRefSlaughter"
    style="max-width: 600px"
    :model="ruleFormSlaughter"
    :rules="rulesSlaughter"
    label-width="auto"
  >
    <el-form-item label="公司名称" prop="companyName">
      <el-input v-model="ruleFormSlaughter.companyName" />
    </el-form-item>

    <el-form-item label="成立时间" prop="founded">
      
       <el-date-picker
        v-model="founded"
        type="date"
        placeholder="请选择"
        value-format="YYYY-MM-DDTHH:mm:ss"
      />
    </el-form-item>

    <el-form-item label="公司地址" prop="companyAddress">

      <el-select v-model="ruleFormSlaughter.provinceId" placeholder="请选择省份" @change="getUrban(ruleFormSlaughter.provinceId)" style="width: 240px;">
        <el-option v-for="value in province" :label="value.provinceName" :value="value.id" />
      </el-select>

      <el-select v-model="ruleFormSlaughter.urbanId" placeholder="请选择市区" style="width: 240px;">
        <el-option v-for="value in urban" :label="value.urbanName" :value="value.id" />
 
      </el-select>

      <el-input v-model="ruleFormSlaughter.companyAddress" type="textarea" />

    </el-form-item>
   
    <el-form-item label="公司简介" prop="companyProfile">
      <el-input v-model="ruleFormSlaughter.companyProfile" type="textarea" />
    </el-form-item>
    <el-form-item>
      <el-button type="primary" @click="qiyeupdate()">
        保存
      </el-button>
    </el-form-item>
  </el-form>
    
  </el-dialog>
             

            </el-card>

            <!-- 企业照片卡片 -->
            <el-card class="info-card" shadow="never">
              <template #header>
                <div class="card-header">
                  <span>企业照片</span>
                </div>
              </template>
              <div class="upload-area">
                <el-upload
            
            :file-list="fileListCompany"
            v-model="fileListCompany"
            action="http://localhost:5073/api/Img/Images"
            list-type="picture-card"
            :limit="9"
            
             :on-success="handleSuccessCompany"
            :on-preview="handlePictureCardPreviewCompany"
            :on-remove="handleRemoveCompany"
           
          >
            <el-icon><Plus /></el-icon>
          </el-upload>
        
          
          
          <el-dialog v-model="dialogVisibleSlaughter">
            <img   w-full   :src="dialogImageUrlSlaughter" alt=""/> 
          </el-dialog>
              </div>
            </el-card>
          </div>
        </el-tab-pane>

        <el-tab-pane label="深加工信息" name="processing">
          <div class="tab-content">
            <!-- 深加工信息卡片 -->
            <el-card class="info-card" shadow="never">
              <template #header>
                <div class="card-header">
                  <span>深加工信息</span>
                  <div class="header-actions">
                        <el-button size="small" type="primary"   @click="disegientProcessing= true"  :disabled="statusProcessing==true">添加</el-button> 
                    <el-button size="small" type="primary"   @click="updDisegientProcessing= true" :disabled="statusProcessing!=true" >修改</el-button>
                    

                       <el-dialog
    v-model="disegientProcessing"
    title="深加工信息添加"
    width="500"
   
  >
  <el-form
    ref="ruleFormRefProcessing"
    style="max-width: 600px"
    :model="ruleFormProcessing"
    :rules="rulesProcessing"
    label-width="auto"
  >
    <el-form-item label="班组" prop="team">
      <el-input v-model="ruleFormProcessing.team" />
    </el-form-item>
    
    <el-form-item label="负责人" prop="head">
      <el-input v-model="ruleFormProcessing.head" />
    </el-form-item>
    
    
    <el-form-item>
      <el-button type="primary" @click="createCultivationsubmitFormProcessing(ruleFormRefProcessing)">
        保存
      </el-button>
      <el-button @click="resetFormProcessing(ruleFormRefProcessing)">取消</el-button>
    </el-form-item>
  </el-form>
  
  </el-dialog>


  <el-dialog
    v-model="updDisegientProcessing"
    title="深加工信息修改"
    width="500"
   
  >
  <el-form
    ref="ruleFormRefProcessing"
    style="max-width: 600px"
    :model="ruleFormProcessing"
    :rules="rulesProcessing"
    label-width="auto"
  >
    <el-form-item label="班组" prop="team">
      <el-input v-model="ruleFormProcessing.team" />
    </el-form-item>
    
    <el-form-item label="负责人" prop="head">
      <el-input v-model="ruleFormProcessing.head" />
    </el-form-item>
    
    
    <el-form-item>
      <el-button type="primary" @click="UpdateCultivationsubmitFormProcessing(ruleFormRefProcessing)">
        保存
      </el-button>
      <el-button @click="resetFormProcessing(ruleFormRefProcessing)">取消</el-button>
    </el-form-item>
  </el-form>
  
  </el-dialog>




                  </div>
                </div>
              </template>
              <div class="info-content">
                <div class="info-row">
                  <span class="label">班组:</span>
                  <span class="value">{{ ruleFormProcessing.team }}</span>
                </div>
                <div class="info-row">
                  <span class="label">负责人:</span>
                  <span class="value">{{ ruleFormProcessing.head }}</span>
                </div>
               
              </div>












            </el-card>

            <!-- 食品安全信息卡片 -->
            <el-card class="info-card" shadow="never">
              <template #header>
                <div class="card-header">
                  <span>食品安全信息</span>
                </div>
              </template>
              <div class="upload-area">
                 <el-upload
            
            :file-list="fileListShipin"
            v-model="fileListShipin"
            action="http://localhost:5073/api/Img/Images"
            list-type="picture-card"
            :limit="9"
            
             :on-success="handleSuccessShipin"
            :on-preview="handlePictureCardPreviewShipin"
            :on-remove="handleRemoveShipin"
           
          >
            <el-icon><Plus /></el-icon>
          </el-upload>
        
          
          
          <el-dialog v-model="dialogVisibleShipin">
            <img   w-full   :src="dialogImageUrlShipin" alt=""/> 
          </el-dialog>
              </div>
            </el-card>

            <!-- 供应商信息卡片 -->
            <el-card class="info-card" shadow="never">
              <template #header>
                <div class="card-header">
                  <span>供应商信息</span>
                </div>
              </template>
              <div class="supplier-sections">
                <div class="supplier-section">
                  <h4>原料</h4>
                   <div class="info-row">
                  <span class="label">生产批次:</span>
                  <span class="value">{{ ruleFormProcessing.rawMaterialProduction }}</span>

                  <el-button size="small" type="primary"   @click="updDisegientRawMaterial= true"  >设置</el-button>

                  <el-dialog
    v-model="updDisegientRawMaterial"
    title="原料设置"
    width="500"
   
  >
  <el-form
    ref="ruleFormRefProcessing"
    style="max-width: 600px"
    :model="ruleFormProcessing"
    :rules="rulesProcessing"
    label-width="auto"
  >
    <el-form-item label="生产批次" prop="rawMaterialProduction">
      <el-input v-model="ruleFormProcessing.rawMaterialProduction" />
    </el-form-item>
    
    <el-form-item>
      <el-button type="primary" @click="createCultivationsubmitFormRawMaterial()">
        保存
      </el-button>
   
    </el-form-item>
  </el-form>
  
  </el-dialog>





                </div>
                  <div class="upload-area">
                    <el-upload
            
            :file-list="fileListRawMaterial"
            v-model="fileListRawMaterial"
            action="http://localhost:5073/api/Img/Images"
            list-type="picture-card"
            :limit="9"
            
             :on-success="handleSuccessRawMaterial"
            :on-preview="handlePictureCardPreviewRawMaterial"
            :on-remove="handleRemoveRawMaterial"
           
          >
            <el-icon><Plus /></el-icon>
          </el-upload>
        
          
          
          <el-dialog v-model="dialogVisibleRawMaterial">
            <img   w-full   :src="dialogImageUrlRawMaterial" alt=""/> 
          </el-dialog>


                  </div>
                </div>
                <div class="supplier-section">
                  <h4>辅料</h4>
                   <div class="info-row">
                  <span class="label">生产批次:</span>
                  <span class="value">{{ ruleFormProcessing.excipientBatches }}</span>

<el-button size="small" type="primary"   @click="updDisegientExcipient= true"  >设置</el-button>

                  <el-dialog
    v-model="updDisegientExcipient"
    title="辅料设置"
    width="500"
   
  >
  <el-form
    ref="ruleFormRefProcessing"
    style="max-width: 600px"
    :model="ruleFormProcessing"
    :rules="rulesProcessing"
    label-width="auto"
  >
    <el-form-item label="生产批次" prop="excipientBatches">
      <el-input v-model="ruleFormProcessing.excipientBatches" />
    </el-form-item>
    
    <el-form-item>
      <el-button type="primary" @click="createCultivationsubmitFormExcipient()">
        保存
      </el-button>
   
    </el-form-item>
  </el-form>
  
  </el-dialog>



                </div>
                  <div class="upload-area">
                   <el-upload
            
            :file-list="fileListExcipient"
            v-model="fileListExcipient"
            action="http://localhost:5073/api/Img/Images"
            list-type="picture-card"
            :limit="9"
            
             :on-success="handleSuccessExcipient"
            :on-preview="handlePictureCardPreviewExcipient"
            :on-remove="handleRemoveExcipient"
           
          >
            <el-icon><Plus /></el-icon>
          </el-upload>
        
          
          
          <el-dialog v-model="dialogVisibleExcipient">
            <img   w-full   :src="dialogImageUrlExcipient" alt=""/> 
          </el-dialog>

          
                  </div>
                </div>
                <div class="supplier-section">
                  <h4>添加剂</h4>
                   <div class="info-row">
                  <span class="label">生产批次:</span>
                  <span class="value">{{ ruleFormProcessing.additiveBatches }}</span>

<el-button size="small" type="primary"   @click="updDisegientadditive= true"  >设置</el-button>

                  <el-dialog
    v-model="updDisegientadditive"
    title="添加剂设置"
    width="500"
   
  >
  <el-form
    ref="ruleFormRefProcessing"
    style="max-width: 600px"
    :model="ruleFormProcessing"
    :rules="rulesProcessing"
    label-width="auto"
  >
    <el-form-item label="生产批次" prop="additiveBatches">
      <el-input v-model="ruleFormProcessing.additiveBatches" />
    </el-form-item>
    
    <el-form-item>
      <el-button type="primary" @click="createCultivationsubmitFormadditive()">
        保存
      </el-button>
   
    </el-form-item>
  </el-form>
  
  </el-dialog>





                </div>
                  <div class="upload-area">
                     <el-upload
            
            :file-list="fileListadditive"
            v-model="fileListadditive"
            action="http://localhost:5073/api/Img/Images"
            list-type="picture-card"
            :limit="9"
            
             :on-success="handleSuccessadditive"
            :on-preview="handlePictureCardPreviewadditive"
            :on-remove="handleRemoveadditive"
           
          >
            <el-icon><Plus /></el-icon>
          </el-upload>
        
          
          
          <el-dialog v-model="dialogVisibleadditive">
            <img   w-full   :src="dialogImageUrladditive" alt=""/> 
          </el-dialog>



                  </div>
                </div>
                <div class="supplier-section">
                  <h4>包材</h4>
                   <div class="info-row">
                  <span class="label">生产批次:</span>
                  <span class="value">{{ ruleFormProcessing.packagingMaterialBatch }}</span>

<el-button size="small" type="primary"   @click="updDisegientpackaging= true"  >设置</el-button>

                  <el-dialog
    v-model="updDisegientpackaging"
    title="包材设置"
    width="500"
   
  >
  <el-form
    ref="ruleFormRefProcessing"
    style="max-width: 600px"
    :model="ruleFormProcessing"
    :rules="rulesProcessing"
    label-width="auto"
  >
    <el-form-item label="生产批次" prop="packagingMaterialBatch">
      <el-input v-model="ruleFormProcessing.packagingMaterialBatch" />
    </el-form-item>
    
    <el-form-item>
      <el-button type="primary" @click="createCultivationsubmitFormpackaging()">
        保存
      </el-button>
   
    </el-form-item>
  </el-form>
  
  </el-dialog>



                </div>
                  <div class="upload-area">
                     <el-upload
            
            :file-list="fileListpackaging"
            v-model="fileListpackaging"
            action="http://localhost:5073/api/Img/Images"
            list-type="picture-card"
            :limit="9"
            
             :on-success="handleSuccesspackaging"
            :on-preview="handlePictureCardPreviewpackaging"
            :on-remove="handleRemovepackaging"
           
          >
            <el-icon><Plus /></el-icon>
          </el-upload>
        
          
          
          <el-dialog v-model="dialogVisiblepackaging">
            <img   w-full   :src="dialogImageUrlpackaging" alt=""/> 
          </el-dialog>




                  </div>
                </div>
              </div>
            </el-card>

            <!-- 企业信息卡片 -->
            <el-card class="info-card" shadow="never">
              <template #header>
                <div class="card-header">
                  <span>企业信息</span>
                  <div class="header-actions">
                    <el-button size="small" type="primary" @click="updDisegientLicense= true">设置</el-button>

                      <el-dialog
    v-model="updDisegientLicense"
    title="企业信息设置"
    width="500"
   
  >
  <el-form
    ref="ruleFormRefProcessing"
    style="max-width: 600px"
    :model="ruleFormProcessing"
    :rules="rulesProcessing"
    label-width="auto"
  >
    <el-form-item label="公司名称" prop="companyName">
      <el-input v-model="ruleFormProcessing.companyName" />
    </el-form-item>
    
    <el-form-item label="生产许可证号" prop="productionLicense">
      <el-input v-model="ruleFormProcessing.productionLicense" />
    </el-form-item>

    <el-form-item>
      <el-button type="primary" @click="createCultivationsubmitFormLicense()">
        保存
      </el-button>
   
    </el-form-item>
  </el-form>
  
  </el-dialog>
                    
                  </div>
                </div>
              </template>
              <div class="info-content">
                <div class="info-row">
                  <span class="label">公司名称:</span>
                  <span class="value">{{ruleFormProcessing.companyName}}</span>
                </div>
                <div class="info-row">
                  <span class="label">生产许可证号:</span>
                  <span class="value">{{ruleFormProcessing.productionLicense  }}</span>
                </div>
              </div>
            </el-card>

            <!-- 企业照片卡片 -->
            <el-card class="info-card" shadow="never">
              <template #header>
                <div class="card-header">
                  <span>企业照片</span>
                </div>
              </template>
              <div class="upload-area">
                <el-upload
            
            :file-list="fileListLicense"
            v-model="fileListLicense"
            action="http://localhost:5073/api/Img/Images"
            list-type="picture-card"
            :limit="9"
            
             :on-success="handleSuccessLicense"
            :on-preview="handlePictureCardPreviewLicense"
            :on-remove="handleRemoveLicense"
           
          >
            <el-icon><Plus /></el-icon>
          </el-upload>
        
          
          
          <el-dialog v-model="dialogVisibleLicense">
            <img   w-full   :src="dialogImageUrlLicense" alt=""/> 
          </el-dialog>



              </div>
            </el-card>
          </div>
        </el-tab-pane>
      </el-tabs>
    </el-card>
  </div>

  
</template>

<script setup lang="ts">
import { ref,reactive, onMounted } from 'vue'
import {  Plus } from '@element-plus/icons-vue'
import { useCounterStore } from "@/stores/counter";
var pinia= useCounterStore()
// 当前激活的标签页
const activeTab = ref('cultivation')



import { ElMessage, type UploadProps, type UploadUserFile } from 'element-plus'
import wirlthttp from '@/router/wirlthttp';
import readhttp from '@/router/readhttp';
import type { FormInstance, FormRules } from 'element-plus'
import { id } from 'element-plus/es/locales.mjs';
import moment from 'moment';


//产品信息
const fileList = ref<UploadUserFile[]>([

])

const dialogImageUrl = ref('')

const dialogVisible = ref(false)

const handleRemove = (file:any) => {
  
  const index = fileList.value.indexOf(file);
  fileList.value.splice(index, 1);

  trace.listImgtrce=JSON.stringify(fileList.value)
  wirlthttp.post('api/Wirlt/AddProduct',{"id": pinia.trace.Id,
   "productQualifications": trace.listImgtrce}).then(res=>{
      if(res.data.code==200)
      {
        ElMessage.success('成功')
      }
   })
}

const trace=reactive({
  listImgtrce:""
})
const handlePictureCardPreview= (uploadFile:any) => {
  dialogImageUrl.value = uploadFile
  dialogVisible.value = true
}

const handleSuccess = (response:any) => {
 
  fileList.value.push({
    name: response.fileName,
    url: response.data
  });
  
  createTraceImg()
};


const createTraceImg=()=>{
  

trace.listImgtrce=JSON.stringify(fileList.value)

   wirlthttp.post('api/Wirlt/AddProduct',{"id": pinia.trace.Id,
   "productQualifications": trace.listImgtrce}).then(res=>{
      if(res.data.code==200)
      {
        ElMessage.success('成功')
      }
   })
}


const getTraceImg=()=>{
  readhttp.get('api/Read/GetTrace',{params:{Id:pinia.trace.Id}}).then(res=>{
    fileList.value=JSON.parse(res.data.data.productQualifications)
  })
  handlePictureCardPreview
}

//产品信息结束










//养殖信息

const disegient=ref(false);
const updDisegient=ref(false);

const ruleFormRef = ref<FormInstance>()

const ruleForm = reactive({
 
  "id": null,
   //养殖参数
  "variety": "",
  "source": "",
  "numberDays": "",
  "feedBrand": "",
  "breedingManager": "",
  //时间
  "dateOfSlaughter": "",
//养殖参数结束


//保健参数
  "healthInformation": "",
//保健参数结束


//动检证参数
  "motionInspection": "",
//动检证参数结束

//企业信息参数
  "farms": "",
  "head": "",
  "number": "",
//企业信息参数结束

//企业图片参数
  "enterpriseImg": "",
//企业图片参数结束


  "traceId": pinia.trace.Id,


})

const locationOptions = ['Home', 'Company', 'School']

const rules = reactive<FormRules>({
  variety: [
    { required: true, message: '请输入品种', trigger: 'blur' },
    //{ min: 3, max: 5, message: 'Length should be 3 to 5', trigger: 'blur' },
  ],
  source: [
    {
      required: true,
      message: '请输入来源',
      trigger: 'blur',
    },
  ],
  numberDays: [
    {
      required: true,
      message: '请输入饲养天数',
      trigger: 'blur',
    },
  ],
  feedBrand: [
    {
      
      required: true,
      message: '请输入饲料品牌',
      trigger: 'blur',
    },
  ],
  breedingManager: [
    {
      
      required: true,
      message: '请输入饲养负责人',
      trigger: 'blur',
    },
  ],
  dateOfSlaughter: [
    {
    
      message: '请选择出栏日期',
      trigger: 'change',
    },
  ],
  
})



const createCultivationsubmitForm = async (formEl: FormInstance | undefined) => {
  if (!formEl) return
  await formEl.validate((valid, fields) => {
    if (valid) {
      console.log('submit!')
      wirlthttp.post("api/Wirlt/AddCultivation",{
        "variety": ruleForm.variety,
  "source": ruleForm.source,
  "numberDays": ruleForm.numberDays,
  "feedBrand": ruleForm.feedBrand,
  "breedingManager": ruleForm.breedingManager,
  "dateOfSlaughter": ruleForm.dateOfSlaughter,
  "healthInformation": ruleForm.healthInformation,
  "motionInspection": ruleForm.motionInspection,
  "farms": ruleForm.farms,
  "head": ruleForm.head,
  "number": ruleForm.number,
  "enterpriseImg": ruleForm.enterpriseImg,
  "traceId": ruleForm.traceId

      }).then(res=>{
        if(res.data.code==200)
      {
         ElMessage.success(res.data.message)
         

  disegient.value=false
  getCultivation();
      }
      else
      {
        ElMessage.error(res.data.message)
      }
      })

    } else {
      console.log('error submit!', fields)
    }
  })
}



const UpdateCultivationsubmitForm = async (formEl: FormInstance | undefined) => {
  if (!formEl) return
  await formEl.validate((valid, fields) => {
    if (valid) {
      console.log('submit!')
      
      wirlthttp.post("api/Wirlt/UpdCultvation",ruleForm).then(res=>{
        if(res.data.code==200)
      {
         ElMessage.success(res.data.message)

      
         updDisegient.value=false
  getCultivation();
      }
      else
      {
        ElMessage.error(res.data.message)
      }
      })

    } else {
      console.log('error submit!', fields)
    }
  })
}


const resetForm = (formEl: FormInstance | undefined) => {
  if (!formEl) return
  formEl.resetFields()
}

const options = Array.from({ length: 10000 }).map((_, idx) => ({
  value: `${idx + 1}`,
  label: `${idx + 1}`,
}))



const getCultivation=()=>{
  readhttp.get("api/Read/GetCultivation",{params:{
    TraceId:pinia.trace.Id
  }}).then(res=>{

   Object.assign(ruleForm,res.data.data)
   healthData.value=JSON.parse(res.data.data.healthInformation)
   
  })
}



////养殖信息结束

















// 保健信息数据
const healthData = ref([
{
    id:1,
    days:"35",
    method:"兔瘟单苗",
    details:"皮下注射",
    isEditing: false
  }
])





// 保存行数据
const handleSave = (index:any) => {
  const row = healthData.value[index];
  
  // 简单验证
  if (!row.days || !row.details || !row.method) {
    ElMessage.warning('请填写完整信息');
    return;
  }

  // 标记为非编辑状态
  row.isEditing = false;
  ElMessage.success('保存成功');

  submitForm()
  
  // 实际项目中这里可以调用API保存到后端
  // console.log('保存数据:', row);
};

const addDomain = () => {
  healthData.value.push({
    id:Date.now(),
    days:"",
    method:"",
    details:"",
    isEditing: true
  })
}

const submitForm =  () => {
  
  ruleForm.healthInformation=JSON.stringify(healthData.value)
      wirlthttp.post('api/Wirlt/UpdCultvation',ruleForm).then(res=>{
        if(res.data.code==200)
      {
         ElMessage.success(res.data.message)
         
          getCultivation();
      }
      else
      {
        ElMessage.error(res.data.message)
      }
     
      })
   
  
}
// 取消编辑
const handleCancel = (index:any) => {
  const row = healthData.value[index];
  
  // 如果是新增的空行，取消时直接删除
  if (
      !row.days && !row.method && !row.details) {
        healthData.value.splice(index, 1);
  } else {
    // 恢复原始数据
   
      row.isEditing = false;
  }
};

// 编辑行
const handleEdit = (index:any) => {

  healthData.value[index].isEditing = true;
};


// 删除行
const handleDelete = (index:any) => {
  
  healthData.value.splice(index, 1);
  ElMessage.success('删除成功');
 
  
};

// 保健信息数据结束














//动检证
const fileListmotion = ref<UploadUserFile[]>([

])

const dialogImageUrlmotion = ref('')

 const dialogVisiblemotion = ref(false)



const handleRemoveMotionInspection = (file:any) => {
  
  const index = fileListmotion.value.indexOf(file);
  fileListmotion.value.splice(index, 1);

  motion.listImgmotion=JSON.stringify(fileListmotion.value)
  wirlthttp.post('api/Wirlt/AddMotion',{"id": pinia.trace.Id,
   "motionInspection": motion.listImgmotion}).then(res=>{
      if(res.data.code==200)
      {
        ElMessage.success('成功')
      }
   })
}

const motion=reactive({
  listImgmotion:""
})
const handlePictureCardPreviewMotionInspection= (uploadFile:any) => {
  dialogImageUrlmotion.value = uploadFile
  dialogVisiblemotion.value = true
}

const handleSuccessMotionInspection = (response:any) => {
 
  fileListmotion.value.push({
    name: response.fileName,
    url: response.data
  });
  
  createTraceImgMotionInspection()
};

const createTraceImgMotionInspection=()=>{
  

  motion.listImgmotion=JSON.stringify(fileListmotion.value)
  
     wirlthttp.post('api/Wirlt/AddMotion',{"id": pinia.trace.Id,
     "motionInspection": motion.listImgmotion}).then(res=>{
        if(res.data.code==200)
        {
          ElMessage.success('成功')
        }
     })
  }
  
  


const getTraceImgMotionInspection=()=>{
  //查询动检证

  readhttp.get('api/Read/GetMotionInspection',{params:{Id:pinia.trace.Id}}).then(res=>{
    fileListmotion.value=JSON.parse(res.data.data.motionInspection)
  })
  handlePictureCardPreviewMotionInspection
}

//动检证结束



//企业信息
const dialogVisibleQiye=ref(false);




const rulesqiye = reactive<FormRules>({
  farms: [
    { required: true, message: '请输入养殖场', trigger: 'blur' },
    //{ min: 3, max: 5, message: 'Length should be 3 to 5', trigger: 'blur' },
  ],
  number: [
    {
     
      message: '请输入存栏数量',
      trigger: 'blur',
    },
  ],
  head: [
    {
      
      message: '请输入负责人',
      trigger: 'blur',
    },
  ],
})

const submitFormQiye = async (formEl: FormInstance | undefined) => {
  if (!formEl) return
  await formEl.validate((valid, fields) => {
    if (valid) {
      console.log('submit!')
      //修改企业信息
      wirlthttp.post('api/Wirlt/UpdateEnterprise',{
        "id": pinia.trace.Id,
  "farms": ruleForm.farms,
  "head": ruleForm.head,
  "number": ruleForm.number
      }).then(res=>{
        if(res.data.code==200)
      {
        ElMessage.success(res.data.message)
        dialogVisibleQiye.value=false;
        getCultivation();
      }
      else
      {
        ElMessage.error(res.data.message)
      }
      })
    } else {
      console.log('error submit!', fields)
    }
  })
}

//企业信息结束




//企业照片

const fileListEnterprise = ref<UploadUserFile[]>([

])

const dialogImageUrlEnterprise = ref('')

 const dialogVisibleEnterprise = ref(false)



const handleRemoveEnterprise = (file:any) => {
  
  const index = fileListEnterprise.value.indexOf(file);
  fileListEnterprise.value.splice(index, 1);

  enterprise.listImgmotion=JSON.stringify(fileListEnterprise.value)
  //保存到数据库
  wirlthttp.post('api/Wirlt/AddEnterpriseImg',{"id": pinia.trace.Id,
   "enterpriseImg": enterprise.listImgmotion}).then(res=>{
      if(res.data.code==200)
      {
        ElMessage.success('成功')
      }
   })
}

const enterprise=reactive({
  listImgmotion:""
})
const handlePictureCardPreviewEnterprise= (uploadFile:any) => {
  dialogImageUrlmotion.value = uploadFile
  dialogVisiblemotion.value = true
}

const handleSuccessEnterprise = (response:any) => {
 
  fileListEnterprise.value.push({
    name: response.fileName,
    url: response.data
  });
  
  createTraceImgEnterprise()
};

const createTraceImgEnterprise=()=>{
  

  enterprise.listImgmotion=JSON.stringify(fileListEnterprise.value)
  
     wirlthttp.post('api/Wirlt/AddEnterpriseImg',{"id": pinia.trace.Id,
     "enterpriseImg": enterprise.listImgmotion}).then(res=>{
        if(res.data.code==200)
        {
          ElMessage.success('成功')
        }
     })
  }
  
  


const getTraceImgEnterprise=()=>{
  //查询企业照片

  readhttp.get('api/Read/GetEnterpriseImg',{params:{Id:pinia.trace.Id}}).then(res=>{
    fileListEnterprise.value=JSON.parse(res.data.data.enterpriseImg)
  })
  handlePictureCardPreviewEnterprise
}

//企业照片结束








//屠宰信息
const getslaughter=()=>{
  readhttp.get("api/Read/GetSlaughterInformation",{params:{TraceId:pinia.trace.Id}}).then(res=>{
       Object.assign(ruleFormSlaughter,res.data.data)
  })
  iffounded()
}


const disegientSlaughter=ref(false);
const updDisegientSlaughter=ref(false);

const ruleFormRefSlaughter = ref<FormInstance>()

const ruleFormSlaughter = reactive({
 
  "id": null,
   //屠宰参数
    "batch": "",
  "averageWeight": 0,
  "arrivalTime": "",
  "slaughterTime": "",
   
  //相关资质
  "qualifications": "",
  //企业信息
  "companyName": "",
  "provinceId": null,
  "urbanId": null,
  "companyAddress": "",
  "founded": "1000-01-01T00:00:00.000Z",
  "companyProfile": "",
  //企业照片
  "enterpriseImg": "",

  "traceId": pinia.trace.Id,

  "provinceName":"",
  "urbanName":""
})



const rulesSlaughter = reactive<FormRules>({
  batch: [
    { required: true, message: '请输入批次', trigger: 'blur' },
    {  max: 30, message: '最多30个字', trigger: 'blur' },
  ],
  averageWeight: [
    {
      required: true,
      message: '请输入到厂均重（公斤）',
      trigger: 'blur',
    },
    {  max: 5, message: '最多5个数字', trigger: 'blur' },
  ],
  arrivalTime: [
    {
      required: true,
      message: '请输入到厂时间',
      trigger: 'blur',
    },
  ],
  slaughterTime: [
    {
      
      required: true,
      message: '请输入屠宰时间',
      trigger: 'blur',
    },
  ],
  qualifications: [
    {
      
      required: true,
      message: '请输入相关资质',
      trigger: 'blur',
    },
  ],
  companyName: [
    {
      required: true,
      message: '请输入公司名称',
      trigger: 'blur',
    },
    {  max: 30, message: '最多30个字', trigger: 'blur' },
  ],
   provinceId: [
    {
     required: true,
      message: '请选择省份',
      trigger: 'blur',
    },
  ],
   urbanId: [
    {
     required: true,
      message: '请选择市区',
      trigger: 'blur',
    },
  ],
   companyAddress: [
    {
     required: true,
      message: '请输入公司地址',
      trigger: 'blur',
    },
    {  max: 200, message: '最多200个字', trigger: 'blur' },
  ],
   founded: [
    {
     required: true,
      message: '请选择成立时间',
      trigger: 'blur',
    },
  ],
  
  companyProfile: [
    {
     required: true,
      message: '请输入公司简介',
      trigger: 'blur',
    },
    {  max: 500, message: '最多500个字', trigger: 'blur' },
  ],
})



const createCultivationsubmitFormSlaughter = async (formEl: FormInstance | undefined) => {
  if (!formEl) return
  await formEl.validate((valid, fields) => {
    if (valid) {
      console.log('submit!')
      wirlthttp.post("api/Wirlt/AddSlaughterInformation",{
       "batch": ruleFormSlaughter.batch,
  "averageWeight": ruleFormSlaughter.averageWeight,
  "arrivalTime": ruleFormSlaughter.arrivalTime,
  "slaughterTime": ruleFormSlaughter.slaughterTime,
  "qualifications": ruleFormSlaughter.qualifications,
  "companyName": ruleFormSlaughter.companyName,
  "provinceId": ruleFormSlaughter.provinceId,
  "urbanId": ruleFormSlaughter.urbanId,
  "companyAddress": ruleFormSlaughter.companyAddress,
  "founded": ruleFormSlaughter.founded,
  "companyProfile": ruleFormSlaughter.companyProfile,
  "enterpriseImg": ruleFormSlaughter.enterpriseImg,
  "traceId": ruleFormSlaughter.traceId

      }).then(res=>{
        if(res.data.code==200)
      {
         ElMessage.success(res.data.message)
         

  disegientSlaughter.value=false
  getslaughter();
  ruleFormSlaughter.founded=""
      }
      else
      {
        ElMessage.error(res.data.message)
      }
      })

    } else {
      console.log('error submit!', fields)
    }
  })
}



const UpdateCultivationsubmitFormSlaughter = async (formEl: FormInstance | undefined) => {
    
  if (!formEl) return
  await formEl.validate((valid, fields) => {
    if (valid) {
      console.log('submit!')
    
      wirlthttp.post("api/Wirlt/UpdSlaughterInformation",ruleFormSlaughter).then(res=>{
        if(res.data.code==200)
      {
         ElMessage.success(res.data.message)

      
         updDisegientSlaughter.value=false
         dialogVisiblegongsi.value=false
   getslaughter();
      }
      else
      {
        ElMessage.error(res.data.message)
      }
      })

    } else {
      console.log('error submit!', fields)
    }
  })
}

const resetFormSlaughter = (formEl: FormInstance | undefined) => {
  if (!formEl) return
  formEl.resetFields()
}
//屠宰信息结束




//相关资质
const fileListSlaughter = ref<UploadUserFile[]>([

])

const dialogImageUrlSlaughter = ref('')

 const dialogVisibleSlaughter= ref(false)



const handleRemoveSlaughter = (file:any) => {
  
  const index = fileListSlaughter.value.indexOf(file);
  fileListSlaughter.value.splice(index, 1);

  slaughter.listImgslaughter=JSON.stringify(fileListSlaughter.value)
  //保存到数据库
  wirlthttp.post('api/Wirlt/AddQualifications',{"id": pinia.trace.Id,
   "qualifications": slaughter.listImgslaughter}).then(res=>{
      if(res.data.code==200)
      {
        ElMessage.success('成功')
      }
   })
}

const slaughter=reactive({
  listImgslaughter:""
})
const handlePictureCardPreviewSlaughter= (uploadFile:any) => {
  dialogImageUrlSlaughter.value = uploadFile
  dialogVisibleSlaughter.value = true
}

const handleSuccessSlaughter = (response:any) => {
 
  fileListSlaughter.value.push({
    name: response.fileName,
    url: response.data
  });
  
  createTraceImgSlaughter()
};

const createTraceImgSlaughter=()=>{
  

  slaughter.listImgslaughter=JSON.stringify(fileListSlaughter.value)
  
     wirlthttp.post('api/Wirlt/AddQualifications',{"id": pinia.trace.Id,
     "qualifications": slaughter.listImgslaughter}).then(res=>{
        if(res.data.code==200)
        {
          ElMessage.success('成功')
        }
     })
  }
  
  


const getTraceImgSlaughter=()=>{
  //查询相关资质照片

  readhttp.get('api/Read/GetQualifications',{params:{Id:pinia.trace.Id}}).then(res=>{
    fileListSlaughter.value=JSON.parse(res.data.data.qualifications)
  })
  handlePictureCardPreviewSlaughter
}

//相关资质结束



//企业信息
const province=ref([
{
      "id": 0,
      "provinceName": "string"
    }
])
const getProvince=()=>{
  readhttp.get('api/Read/GetProvince',{}).then(res=>{
     province.value=res.data.data
  })
}

const urban=ref([
{
      "id": 0,
      "urbanName": "string"
    }
])
const getUrban=(id:any)=>{
   readhttp.get('api/Read/GetUrban',{params:{Id:id}}).then(res=>{
     urban.value=res.data.data
  })
}

const founded=ref("")
const iffounded=()=>{
   if(ruleFormSlaughter.founded=="1000-01-01T00:00:00.000Z")
   {
      founded.value=""
   }
   else
   {
    founded.value=ruleFormSlaughter.founded
   }
   
}


const dialogVisiblegongsi=ref(false);

const qiyeupdate=()=>{
  wirlthttp.post('api/Wirlt/UpdCompany',{
     "companyName": ruleFormSlaughter.companyName,
  "provinceId": ruleFormSlaughter.provinceId,
  "urbanId": ruleFormSlaughter.urbanId,
  "companyAddress": ruleFormSlaughter.companyAddress,
  "founded": founded.value,
  "companyProfile": ruleFormSlaughter.companyProfile,
  "traceId": pinia.trace.Id}).then(res=>{
     if(res.data.code==200)
     {
      ElMessage.success(res.data.message);
      dialogVisiblegongsi.value=false
      getslaughter()
     }
  })
}
//企业信息结束




//企业照片
const fileListCompany = ref<UploadUserFile[]>([

])

const dialogImageUrlCompany = ref('')

 const dialogVisibleCompany= ref(false)



const handleRemoveCompany = (file:any) => {
  
  const index = fileListCompany.value.indexOf(file);
  fileListCompany.value.splice(index, 1);

  slaughter.listImgslaughter=JSON.stringify(fileListCompany.value)
  //保存到数据库
  wirlthttp.post('api/Wirlt/AddCompany',{"id": pinia.trace.Id,
   "enterpriseImg": slaughter.listImgslaughter}).then(res=>{
      if(res.data.code==200)
      {
        ElMessage.success('成功')
      }
   })
}

const company=reactive({
  listImgsCompany:""
})
const handlePictureCardPreviewCompany= (uploadFile:any) => {
  dialogImageUrlCompany.value = uploadFile
  dialogVisibleCompany.value = true
}

const handleSuccessCompany = (response:any) => {
 
  fileListCompany.value.push({
    name: response.fileName,
    url: response.data
  });
  
  createTraceImgCompany()
};

const createTraceImgCompany=()=>{
  

  company.listImgsCompany=JSON.stringify(fileListCompany.value)
  
     wirlthttp.post('api/Wirlt/AddCompany',{"id": pinia.trace.Id,
     "enterpriseImg": company.listImgsCompany}).then(res=>{
        if(res.data.code==200)
        {
          ElMessage.success('成功')
        }
     })
  }
  
  


const getTraceImgCompany=()=>{
  //查询相关资质照片

  readhttp.get('api/Read/GetCompany',{params:{Id:pinia.trace.Id}}).then(res=>{
    fileListCompany.value=JSON.parse(res.data.data.enterpriseImg)
  })
  handlePictureCardPreviewCompany
}

//企业照片结束






//深加工信息
const getProcessing=()=>{
  readhttp.get("api/Read/GetProcessing",{params:{TraceId:pinia.trace.Id}}).then(res=>{
       Object.assign(ruleFormProcessing,res.data.data)
  })
}


const disegientProcessing=ref(false);
const updDisegientProcessing=ref(false);

const ruleFormRefProcessing = ref<FormInstance>()

const ruleFormProcessing = reactive({
 
  "id": null,
   "team": "",
  "head": "",
  "foodSafety": "",
  "rawMaterialProduction": "",
  "rawMaterialInformation": "",
  "excipientBatches": "",
  "excipientInformation": "",
  "additiveBatches": "",
  "additiveInformation": "",
  "packagingMaterialBatch": "",
  "packagingMaterialInformation": "",
  "companyName": "",
  "productionLicense": "",
  "enterpriseImg": "",
  "traceId": pinia.trace.Id
})



const rulesProcessing = reactive<FormRules>({
  team: [
    { required: true, message: '请输入班组', trigger: 'blur' },
  
  ],
  head: [
    {
      required: true,
      message: '请输入负责人',
      trigger: 'blur',
    },
  ],
  foodSafety: [
    {
      required: true,
      message: '请输入食品安全信息',
      trigger: 'blur',
    },
  ],
  rawMaterialProduction: [
    {
      
      required: true,
      message: '请输入原料生产批次',
      trigger: 'blur',
    },
  ],
  rawMaterialInformation: [
    {
      
      required: true,
      message: '请输入原料相关资料',
      trigger: 'blur',
    },
  ],
  excipientBatches: [
    {
      required: true,
      message: '请输入辅料生产批次',
      trigger: 'blur',
    },
   
  ],
   excipientInformation: [
    {
     required: true,
      message: '请输入辅料相关资料',
      trigger: 'blur',
    },
  ],
   additiveBatches: [
    {
     required: true,
      message: '请输入添加剂生产批次',
      trigger: 'blur',
    },
  ],
   additiveInformation: [
    {
     required: true,
      message: '请输入添加剂相关资料',
      trigger: 'blur',
    },
    
  ],
   packagingMaterialBatch: [
    {
     required: true,
      message: '请输入包材生产批次',
      trigger: 'blur',
    },
  ],
  
  packagingMaterialInformation: [
    {
     required: true,
      message: '请输入包材相关资料',
      trigger: 'blur',
    },
  ],
  companyName: [
    {
     required: true,
      message: '请输入公司名称',
      trigger: 'blur',
    },
  ],
  productionLicense: [
    {
     required: true,
      message: '请输入生产许可证号',
      trigger: 'blur',
    },
  ],
  enterpriseImg: [
    {
     required: true,
      message: '请输入企业照片',
      trigger: 'blur',
    },
  ],
})



const createCultivationsubmitFormProcessing = async (formEl: FormInstance | undefined) => {
  if (!formEl) return
  await formEl.validate((valid, fields) => {
    if (valid) {
      console.log('submit!')
      wirlthttp.post("api/Wirlt/AddProcessing",{
      "team": ruleFormProcessing.team,
  "head": ruleFormProcessing.head,
  "foodSafety": ruleFormProcessing.foodSafety,
  "rawMaterialProduction": ruleFormProcessing.rawMaterialProduction,
  "rawMaterialInformation": ruleFormProcessing.rawMaterialInformation,
  "excipientBatches": ruleFormProcessing.excipientBatches,
  "excipientInformation": ruleFormProcessing.excipientInformation,
  "additiveBatches": ruleFormProcessing.additiveBatches,
  "additiveInformation": ruleFormProcessing.additiveInformation,
  "packagingMaterialBatch": ruleFormProcessing.packagingMaterialBatch,
  "packagingMaterialInformation": ruleFormProcessing.packagingMaterialInformation,
  "companyName": ruleFormProcessing.companyName,
  "productionLicense": ruleFormProcessing.productionLicense,
  "enterpriseImg": ruleFormProcessing.enterpriseImg,
  "traceId": pinia.trace.Id

      }).then(res=>{
        if(res.data.code==200)
      {
         ElMessage.success(res.data.message)
         

  disegientProcessing.value=false
  getProcessing();
 
      }
      else
      {
        ElMessage.error(res.data.message)
      }
      })

    } else {
      console.log('error submit!', fields)
    }
  })
}



const UpdateCultivationsubmitFormProcessing = async (formEl: FormInstance | undefined) => {
    
  if (!formEl) return
  await formEl.validate((valid, fields) => {
    if (valid) {
      console.log('submit!')
    
      wirlthttp.post("api/Wirlt/UpdProcessing",ruleFormProcessing).then(res=>{
        if(res.data.code==200)
      {
         ElMessage.success(res.data.message)

      
         updDisegientProcessing.value=false
         disegientProcessing.value=false
   getProcessing();
      }
      else
      {
        ElMessage.error(res.data.message)
      }
      })

    } else {
      console.log('error submit!', fields)
    }
  })
}

const resetFormProcessing = (formEl: FormInstance | undefined) => {
  if (!formEl) return
  formEl.resetFields()
}
//深加工信息结束





//食品安全信息

const fileListShipin = ref<UploadUserFile[]>([

])

const dialogImageUrlShipin = ref('')

 const dialogVisibleShipin= ref(false)



const handleRemoveShipin = (file:any) => {
  
  const index = fileListShipin.value.indexOf(file);
  fileListShipin.value.splice(index, 1);

  shipin.listImgsShipin=JSON.stringify(fileListShipin.value)
  //保存到数据库
  wirlthttp.post('api/Wirlt/AddFoodSafety',{"id": pinia.trace.Id,
   "foodSafety": shipin.listImgsShipin}).then(res=>{
      if(res.data.code==200)
      {
        ElMessage.success('成功')
      }
   })
}

const shipin=reactive({
  listImgsShipin:""
})
const handlePictureCardPreviewShipin= (uploadFile:any) => {
  dialogImageUrlShipin.value = uploadFile
  dialogVisibleShipin.value = true
}

const handleSuccessShipin = (response:any) => {
 
  fileListShipin.value.push({
    name: response.fileName,
    url: response.data
  });
  
  createTraceImgShipin()
};

const createTraceImgShipin=()=>{
  

  shipin.listImgsShipin=JSON.stringify(fileListShipin.value)
  
     wirlthttp.post('api/Wirlt/AddFoodSafety',{"id": pinia.trace.Id,
   "foodSafety": shipin.listImgsShipin}).then(res=>{
        if(res.data.code==200)
        {
          ElMessage.success('成功')
        }
     })
  }
  
  


const getTraceImgShipin=()=>{
  //查询相关资质照片

  readhttp.get('api/Read/GetFoodSafety',{params:{Id:pinia.trace.Id}}).then(res=>{
    fileListShipin.value=JSON.parse(res.data.data.foodSafety)
  })
  handlePictureCardPreviewShipin
}
//食品安全信息结束



//供应商信息
//原料
const updDisegientRawMaterial=ref(false)

const createCultivationsubmitFormRawMaterial=()=>{
  wirlthttp.post('api/Wirlt/AddRawMaterialProduction',{
    "id": pinia.trace.Id,
  "rawMaterialProduction": ruleFormProcessing.rawMaterialProduction
  }).then(res=>{
    if(res.data.code==200)
  {
    ElMessage.success(res.data.message)
    updDisegientRawMaterial.value=false
  }
  })
}
//原料相关资料
const fileListRawMaterial = ref<UploadUserFile[]>([

])

const dialogImageUrlRawMaterial = ref('')

 const dialogVisibleRawMaterial= ref(false)



const handleRemoveRawMaterial = (file:any) => {
  
  const index = fileListRawMaterial.value.indexOf(file);
  fileListRawMaterial.value.splice(index, 1);

  rawMaterial.listImgsRawMaterial=JSON.stringify(fileListRawMaterial.value)
  //保存到数据库
  wirlthttp.post('api/Wirlt/AddRawImg',{"id": pinia.trace.Id,
   "rawMaterialInformation": rawMaterial.listImgsRawMaterial}).then(res=>{
      if(res.data.code==200)
      {
        ElMessage.success('成功')
      }
   })
}

const rawMaterial=reactive({
  listImgsRawMaterial:""
})
const handlePictureCardPreviewRawMaterial= (uploadFile:any) => {
  dialogImageUrlRawMaterial.value = uploadFile
  dialogVisibleRawMaterial.value = true
}

const handleSuccessRawMaterial = (response:any) => {
 
  fileListRawMaterial.value.push({
    name: response.fileName,
    url: response.data
  });
  
  createTraceImgRawMaterial()
};

const createTraceImgRawMaterial=()=>{
  

  rawMaterial.listImgsRawMaterial=JSON.stringify(fileListRawMaterial.value)
  
      wirlthttp.post('api/Wirlt/AddRawImg',{"id": pinia.trace.Id,
   "rawMaterialInformation": rawMaterial.listImgsRawMaterial}).then(res=>{
        if(res.data.code==200)
        {
          ElMessage.success('成功')
        }
     })
  }
  
  


const getTraceImgRawMaterial=()=>{
  //查询相关资质照片

  readhttp.get('api/Read/GetRawImg',{params:{Id:pinia.trace.Id}}).then(res=>{
    fileListRawMaterial.value=JSON.parse(res.data.data.rawMaterialInformation)
  })
  handlePictureCardPreviewRawMaterial
}

//原料相关资料结束

//辅料批次
const updDisegientExcipient=ref(false)

const createCultivationsubmitFormExcipient=()=>{
    wirlthttp.post('api/Wirlt/AddExcipientBatches',{
    "id": pinia.trace.Id,
  "excipientBatches": ruleFormProcessing.excipientBatches
  }).then(res=>{
    if(res.data.code==200)
  {
    ElMessage.success(res.data.message)
    updDisegientExcipient.value=false
  }
  })
}
//辅料相关资料

const fileListExcipient = ref<UploadUserFile[]>([

])

const dialogImageUrlExcipient = ref('')

 const dialogVisibleExcipient= ref(false)



const handleRemoveExcipient = (file:any) => {
  
  const index = fileListExcipient.value.indexOf(file);
  fileListExcipient.value.splice(index, 1);

  excipient.listImgsExcipient=JSON.stringify(fileListExcipient.value)
  //保存到数据库
  wirlthttp.post('api/Wirlt/AddExcipientImg',{"id": pinia.trace.Id,
   "excipientInformation": excipient.listImgsExcipient}).then(res=>{
      if(res.data.code==200)
      {
        ElMessage.success('成功')
      }
   })
}

const excipient=reactive({
  listImgsExcipient:""
})
const handlePictureCardPreviewExcipient= (uploadFile:any) => {
  dialogImageUrlExcipient.value = uploadFile
  dialogVisibleExcipient.value = true
}

const handleSuccessExcipient = (response:any) => {
 
  fileListExcipient.value.push({
    name: response.fileName,
    url: response.data
  });
  
  createTraceImgExcipient()
};

const createTraceImgExcipient=()=>{
  

  excipient.listImgsExcipient=JSON.stringify(fileListExcipient.value)
  
      wirlthttp.post('api/Wirlt/AddExcipientImg',{"id": pinia.trace.Id,
   "excipientInformation": excipient.listImgsExcipient}).then(res=>{
        if(res.data.code==200)
        {
          ElMessage.success('成功')
        }
     })
  }
  
  


const getTraceImgExcipient=()=>{
  //查询相关资质照片

  readhttp.get('api/Read/GetExcipientImg',{params:{Id:pinia.trace.Id}}).then(res=>{
    fileListExcipient.value=JSON.parse(res.data.data.excipientInformation)
  })
  handlePictureCardPreviewExcipient
}


//辅料结束

//添加剂
const updDisegientadditive=ref(false)

const createCultivationsubmitFormadditive=()=>{
    wirlthttp.post('api/Wirlt/AddAdditiveBatches',{
    "id": pinia.trace.Id,
  "additiveBatches": ruleFormProcessing.additiveBatches
  }).then(res=>{
    if(res.data.code==200)
  {
    ElMessage.success(res.data.message)
    updDisegientadditive.value=false
  }
  })
}
//添加剂相关资质

const fileListadditive = ref<UploadUserFile[]>([

])

const dialogImageUrladditive = ref('')

 const dialogVisibleadditive= ref(false)



const handleRemoveadditive= (file:any) => {
  
  const index = fileListadditive.value.indexOf(file);
  fileListadditive.value.splice(index, 1);

  additive.listImgsadditive=JSON.stringify(fileListadditive.value)
  //保存到数据库
  wirlthttp.post('api/Wirlt/AddAdditiveImg',{"id": pinia.trace.Id,
   "additiveInformation": additive.listImgsadditive}).then(res=>{
      if(res.data.code==200)
      {
        ElMessage.success('成功')
      }
   })
}

const additive=reactive({
  listImgsadditive:""
})
const handlePictureCardPreviewadditive= (uploadFile:any) => {
  dialogImageUrladditive.value = uploadFile
  dialogVisibleadditive.value = true
}

const handleSuccessadditive = (response:any) => {
 
  fileListadditive.value.push({
    name: response.fileName,
    url: response.data
  });
  
  createTraceImgadditive()
};

const createTraceImgadditive=()=>{
  

  additive.listImgsadditive=JSON.stringify(fileListadditive.value)
  
      wirlthttp.post('api/Wirlt/AddAdditiveImg',{"id": pinia.trace.Id,
   "additiveInformation": additive.listImgsadditive}).then(res=>{
        if(res.data.code==200)
        {
          ElMessage.success('成功')
        }
     })
  }
  
  


const getTraceImgadditive=()=>{
  //查询相关资质照片

  readhttp.get('api/Read/GetAdditiveImg',{params:{Id:pinia.trace.Id}}).then(res=>{
    fileListadditive.value=JSON.parse(res.data.data.additiveInformation)
  })
  handlePictureCardPreviewadditive
}

//添加剂结束

//包材批次
const updDisegientpackaging=ref(false)

const createCultivationsubmitFormpackaging=()=>{
 wirlthttp.post('api/Wirlt/AddPackagingMaterialBatch',{
    "id": pinia.trace.Id,
  "packagingMaterialBatch": ruleFormProcessing.packagingMaterialBatch
  }).then(res=>{
    if(res.data.code==200)
  {
    ElMessage.success(res.data.message)
    updDisegientpackaging.value=false
  }
  })
}

//包材相关资质
const fileListpackaging = ref<UploadUserFile[]>([

])

const dialogImageUrlpackaging = ref('')

 const dialogVisiblepackaging= ref(false)



const handleRemovepackaging= (file:any) => {
  
  const index = fileListpackaging.value.indexOf(file);
  fileListpackaging.value.splice(index, 1);

  packaging.listImgspackaging=JSON.stringify(fileListpackaging.value)
  //保存到数据库
  wirlthttp.post('api/Wirlt/AddPackagingMaterialImg',{"id": pinia.trace.Id,
   "packagingMaterialInformation": packaging.listImgspackaging}).then(res=>{
      if(res.data.code==200)
      {
        ElMessage.success('成功')
      }
   })
}

const packaging=reactive({
  listImgspackaging:""
})
const handlePictureCardPreviewpackaging= (uploadFile:any) => {
  dialogImageUrlpackaging.value = uploadFile
  dialogVisiblepackaging.value = true
}

const handleSuccesspackaging = (response:any) => {
 
  fileListpackaging.value.push({
    name: response.fileName,
    url: response.data
  });
  
  createTraceImgpackaging()
};

const createTraceImgpackaging=()=>{
  

  packaging.listImgspackaging=JSON.stringify(fileListpackaging.value)
  
      wirlthttp.post('api/Wirlt/AddPackagingMaterialImg',{"id": pinia.trace.Id,
   "packagingMaterialInformation": packaging.listImgspackaging}).then(res=>{
        if(res.data.code==200)
        {
          ElMessage.success('成功')
        }
     })
  }
  
  


const getTraceImgpackaging=()=>{
  //查询相关资质照片

  readhttp.get('api/Read/GetPackagingMaterialImg',{params:{Id:pinia.trace.Id}}).then(res=>{
    fileListpackaging.value=JSON.parse(res.data.data.packagingMaterialInformation)
  })
  handlePictureCardPreviewpackaging
}
//包材结束

//企业信息

const updDisegientLicense=ref(false)

const createCultivationsubmitFormLicense=()=>{
   wirlthttp.post('api/Wirlt/AddProductionCommand',{
    "id": pinia.trace.Id,
  "companyName": ruleFormProcessing.companyName,
  "productionLicense": ruleFormProcessing.productionLicense
  }).then(res=>{
    if(res.data.code==200)
  {
    ElMessage.success(res.data.message)
    updDisegientLicense.value=false
  }
  })
}
//企业照片
const fileListLicense = ref<UploadUserFile[]>([

])

const dialogImageUrlLicense = ref('')

 const dialogVisibleLicense= ref(false)



const handleRemoveLicense= (file:any) => {
  
  const index = fileListLicense.value.indexOf(file);
  fileListLicense.value.splice(index, 1);

  license.listImgsLicense=JSON.stringify(fileListLicense.value)
  //保存到数据库
  wirlthttp.post('api/Wirlt/AddProductionEnterpriseImg',{"id": pinia.trace.Id,
   "enterpriseImg": license.listImgsLicense}).then(res=>{
      if(res.data.code==200)
      {
        ElMessage.success('成功')
      }
   })
}

const license=reactive({
  listImgsLicense:""
})
const handlePictureCardPreviewLicense= (uploadFile:any) => {
  dialogImageUrlLicense.value = uploadFile
  dialogVisibleLicense.value = true
}

const handleSuccessLicense = (response:any) => {
 
  fileListLicense.value.push({
    name: response.fileName,
    url: response.data
  });
  
  createTraceImgLicense()
};

const createTraceImgLicense=()=>{
  

  license.listImgsLicense=JSON.stringify(fileListLicense.value)
  
      wirlthttp.post('api/Wirlt/AddProductionEnterpriseImg',{"id": pinia.trace.Id,
   "enterpriseImg": license.listImgsLicense}).then(res=>{
        if(res.data.code==200)
        {
          ElMessage.success('成功')
        }
     })
  }
  
  


const getTraceImgLicense=()=>{
  //查询相关资质照片

  readhttp.get('api/Read/GetProductionEnterpriseImg',{params:{Id:pinia.trace.Id}}).then(res=>{
    fileListLicense.value=JSON.parse(res.data.data.enterpriseImg)
  })
  handlePictureCardPreviewLicense
}


//结束





//信息数据反填
const status=ref(false)
const listxinashi=()=>{
 
  
  readhttp.get('api/Read/ListCultivation',{params:{TraceId:pinia.trace.Id}}).then(res=>{
   
    if(res.data.data==1)
{
 

  getCultivation()
  status.value=true
}
  })  
}


const statusSlaughter=ref(false)
const listslaughter=()=>{
  readhttp.get('api/Read/ListSlaughterInformation',{params:{TraceId:pinia.trace.Id}}).then(res=>{
    if(res.data.data==1)
{
 

  getslaughter()
  statusSlaughter.value=true
}
  })
}

const statusProcessing=ref(false)
const listProcessing=()=>{
  readhttp.get('api/Read/ListProcessing',{params:{TraceId:pinia.trace.Id}}).then(res=>{
    if(res.data.data==1)
{
 

  getProcessing()
  statusProcessing.value=true
}
  })
}




onMounted(()=>{
getTraceImgMotionInspection()
getTraceImgEnterprise()

getTraceImg()

getTraceImgSlaughter()
getTraceImgCompany()

listslaughter()
listxinashi()


getProvince()
listProcessing()

getTraceImgShipin()
getTraceImgRawMaterial()
getTraceImgExcipient()
getTraceImgadditive()
getTraceImgpackaging()
getTraceImgLicense()
})
</script>

<style scoped>
.product-info-container {
  padding: 20px;
  background-color: #f5f5f5;
  min-height: 100vh;
}

.product-overview {
  margin-bottom: 20px;
}

.overview-content {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.product-left {
  display: flex;
  gap: 20px;
}

.product-image {
  position: relative;
  width: 120px;
  height: 120px;
}

.product-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
}

.image-label {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
}

.product-details {
  flex: 1;
}

.product-title {
  margin: 0 0 16px 0;
  font-size: 24px;
  font-weight: 600;
  color: #303133;
}

.product-meta {
  margin-bottom: 20px;
}

.meta-item {
  margin-bottom: 8px;
  color: #606266;
  font-size: 14px;
}

.inspection-report {
  margin-top: 20px;
}

.inspection-report label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: #303133;
}

.product-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.main-content {
  margin-bottom: 20px;
}

.info-tabs {
  margin-top: 20px;
}

.tab-content {
  padding: 20px 0;
}

.info-card {
  margin-bottom: 20px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.badge {
  margin-left: 8px;
}

.info-content {
  padding: 16px 0;
}

.info-row {
  display: flex;
  margin-bottom: 12px;
}

.info-row .label {
  width: 120px;
  color: #606266;
  font-weight: 500;
}

.info-row .value {
  color: #303133;
  flex: 1;
}

.upload-area {
  padding: 16px 0;
}

.supplier-sections {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  padding: 16px 0;
}

.supplier-section h4 {
  margin: 0 0 12px 0;
  color: #303133;
  font-size: 14px;
}

:deep(.el-tabs__item) {
  font-size: 16px;
  font-weight: 500;
}

:deep(.el-card) {
  border-radius: 8px;
}

:deep(.el-button) {
  border-radius: 6px;
}

:deep(.el-upload--picture-card) {
  width: 100px;
  height: 100px;
  line-height: 100px;
}
</style>
